<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?php echo isset($page_title) ? $page_title . ' - ' : ''; ?>Roielune - Luxury Home Fragrance</title>
    <link rel="stylesheet" href="/chuan/513i/assets/css/style.css">
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Irish+Grover&display=swap" rel="stylesheet">
</head>
<body>
<header class="header">
    <div class="container">
        <div class="header-content">
            <div class="logo">
                <a href="/chuan/513i/" aria-label="Roielune">
                    <img src="/chuan/513i/assets/images/logo.png" alt="Roielune logo">
                    <i class="fas fa-spa"></i>
                    <span class="brand-name">Roielune</span>
                </a>
            </div>
            
            <nav class="main-nav">
                <ul>
                    <li><a href="/chuan/513i/">Home</a></li>
                    <li><a href="/chuan/513i/products/">Products</a></li>
                    <li><a href="/chuan/513i/about.php">About</a></li>
                    <li><a href="/chuan/513i/contact.php">Contact</a></li>
                    <li class="dropdown">
                        <?php if (isLoggedIn()): ?>
                            <a href="#" class="dropdown-toggle">
                                <i class="fab fa-wordpress"></i> WordPress <i class="fas fa-chevron-down"></i>
                            </a>
                            <div class="dropdown-menu">
                                <a href="/chuan/513i/WordPress/" target="_blank">
                                    <i class="fas fa-globe"></i> WordPress Site
                                </a>
                                <a href="/chuan/513i/WordPress/wp-admin/" target="_blank">
                                    <i class="fas fa-cog"></i> WordPress Admin
                                </a>
                            </div>
                        <?php else: ?>
                            <a href="/chuan/513i/auth/login.php" class="wordpress-login-prompt" onclick="showLoginMessage(event)">
                                <i class="fab fa-wordpress"></i> WordPress
                                <span class="tooltip">Please login to access WordPress</span>
                            </a>
                        <?php endif; ?>
                    </li>
                </ul>
            </nav>
            
            <div class="header-actions">
                <div class="search-box">
                    <form action="/chuan/513i/products/" method="GET">
                        <input type="text" name="search" placeholder="Search fragrances..." value="<?php echo isset($_GET['search']) ? htmlspecialchars($_GET['search']) : ''; ?>">
                        <button type="submit"><i class="fas fa-search"></i></button>
                    </form>
                </div>
                
                <div class="cart-icon">
                    <a href="/chuan/513i/cart/">
                        <i class="fas fa-shopping-cart"></i>
                        <span class="cart-count" id="cart-count">
                            <?php 
                            if (isLoggedIn()) {
                                $cart_items = getCartItems($pdo, $_SESSION['user_id']);
                                echo count($cart_items);
                            } else {
                                echo '0';
                            }
                            ?>
                        </span>
                    </a>
                </div>
                
                <div class="user-menu">
                    <?php if (isLoggedIn()): ?>
                        <div class="dropdown">
                            <button class="dropdown-toggle">
                                <i class="fas fa-user"></i>
                                <?php echo htmlspecialchars($_SESSION['first_name']); ?>
                                <i class="fas fa-chevron-down"></i>
                            </button>
                            <div class="dropdown-menu">
                                <a href="/chuan/513i/user/profile.php">Profile</a>
                                <a href="/chuan/513i/user/orders.php">My Orders</a>
                                <?php if (isAdmin()): ?>
                                    <a href="/chuan/513i/admin/">Admin Dashboard</a>
                                <?php endif; ?>
                                <a href="/chuan/513i/auth/logout.php">Logout</a>
                            </div>
                        </div>
                    <?php else: ?>
                        <div class="auth-links">
                            <a href="/chuan/535g/auth/login.php" class="btn btn-outline">Login</a>
                            <a href="/chuan/535g/auth/register.php" class="btn btn-primary">Register</a>
                        </div>
                    <?php endif; ?>
                </div>
            </div>
        </div>
    </div>
</header>
